import pygame

class actionMenu_c:
    def __init__(self, buttonWidth, menuImage, gameObj):
        self.buttonWidth = buttonWidth
        self.menuImage = menuImage
        self.width = menuImage.get_width()
        self.height = menuImage.get_height()
        self.game = gameObj
        self.selectedButton = 0
        
        self.outImage = self.menuImage.copy()
        self.click(0,0)

    def click(self, x, y):
        self.selectedButton = x / self.buttonWidth
        self.drawSelectedBox()
        print "Menu clicked" + str(self.selectedButton)
        self.game.crntPlayer.clickAction=self.game.menuActions[self.selectedButton]
    
    def drawSelectedBox(self):
        self.outImage = self.menuImage.copy()
        pygame.draw.rect(self.outImage, (255,255,255), (self.buttonWidth*(self.selectedButton), 0, 32, self.height), 1)
    
    #this is all hierachical etc, but for speed sake we should just blit it straight onto the main surface
    def getImage(self):
        return self.outImage
